package pers.liyan.shi.springcloud.consumeruser.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pers.liyan.shi.springcloud.producerticketclient.domain.Ticket;
import pers.liyan.shi.springcloud.producerticketclient.client.TicketClient;

/**
 * userService
 *
 * @author shily
 * @date 2019/4/21 1:26
 */
@Service
public class UserService {
    @Autowired
    private TicketClient ticketClient;


    /**
     * 获取电影票, 调用微服务
     *
     * @param movieName 电影名
     * @param userName  用户名
     * @return pers.liyan.shi.springcloud.producerticketclient.domain.Ticket
     * @author shily
     * @date 2019/4/21 1:26
     */
    public Ticket buyTicket(String movieName, String userName) {
        if ("VIP".equals(userName)) {
            return ticketClient.buyTicket(movieName);
        } else {
            return ticketClient.buyTicket("不卖");
        }
    }
}
